package Thread;

/**
 * 创建两个继承Thread类的实体类然后重写run方法实现多线程操作
 */
class ThreadRunnable {
    public static void main(String[] args) {
        Thread thread = new Thread(new Game1());
        Thread thread1 = new Thread(new Music1());
        thread1.start();
        thread.start();
    }

}

class Game1 implements Runnable {
    @Override
    public void run() {
        day();
    }
    public void day(){
        while (true)
        System.out.println("打游戏");
    }
}

class Music1 implements Runnable {
    @Override
    public void run() {
        while (true)
        System.out.println("听音乐");
    }
}
